<template>
	<view class="indexs">
		<view :class="'header ' + (banertrue ? 'header_lan' : '')" :style="'padding-top: ' + navH + 'px;' + 'background:#ffffff'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_sharing_order_detail_join.Group_details') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;padding-bottom:130rpx;'">
			<view class="pintuan_details_center">
				<view class="pintuan_details_item1">
					<image :src="leader['avatarUrl'] ? leader['avatarUrl'] : imgUrl + '/dzx_img19.png'" mode="aspectFill"></image>
					<view class="pintuan_details_item1_t2">{{ leader['nickName'] }}</view>
					<view class="pintuan_details_item1_t1">{{ $t('page_sharing_order_detail_join.Head_regiment') }}</view>
				</view>
				<view class="pintuan_details_item2">
					<view class="pintuan_details_item2_title">
						<image :src="imgUrl + '/dzx_img27.png'"></image>
						<text>{{ xiangqingdetail['title'] }}</text>
					</view>
					<view class="pintuan_details_item2_list">
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.consolidation_warehouse') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['storage']?xiangqingdetail['storage']['shop_name']:"" }}</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Receiving_address') }}</view>
							<view class="pintuan_details_item2_t2">
								{{ xiangqingdetail.address?xiangqingdetail.address['country']:"" }}
								{{ xiangqingdetail.address?xiangqingdetail.address['province']:"" }}
								{{ xiangqingdetail.address?xiangqingdetail.address['city']:""}}
								{{ xiangqingdetail.address?xiangqingdetail.address['region']:"" }}
							</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Express_way') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['line']?xiangqingdetail['line']['name']:"" }}</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Opening_time') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['start_time'] }}</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Group_size') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['max_people'] }}</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Lifting_weight') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['min_weight'] }}</view>
						</view>
						<view class="pintuan_details_item2_cont">
							<view class="pintuan_details_item2_t1">{{ $t('page_sharing_order_detail_join.Head_remarks') }}</view>
							<view class="pintuan_details_item2_t2">{{ xiangqingdetail['group_leader_remark'] }}</view>
						</view>
					</view>
				</view>
				<view class="pintuan_details_item3">
					<view class="pintuan_details_item3_t">
						<view class="pintuan_details_item2_title">
							<image :src="imgUrl + '/dzx_img79.png'"></image>
							<text>{{ $t('page_sharing_order_detail_join.Grouping_progress') }}</text>
						</view>
						<view class="pintuan_details_item3_list" style="margin-bottom: 45px">
							<view class="process-wrap">
								<view class="process-bar" :style="'width:' + xiangqingdetail.percent + '%'">
									<view class="cur-text">{{ xiangqingdetail.percent }}%</view>
								</view>
							</view>
						</view>
					</view>
					<view class="pintuan_details_item3_t">
						<view class="pintuan_details_item2_title">
							<image :src="imgUrl + '/dzx_img79.png'"></image>
							<text>{{ $t('page_sharing_order_detail_join.Member_information') }}</text>
						</view>
						<view class="pintuan_details_item3_list">
							<view class="pintuan_details_item3_cont" v-for="(item, index) in xiangqingdetail.join_user_list">
								<image :src="item.avatarUrl" mode="aspectFill"></image>
							</view>
						</view>
					</view>
					<view class="pintuan_details_item3_b">
						<view class="pintuan_details_item2_title">
							<image :src="imgUrl + '/dzx_img26.png'"></image>
							<text>{{ $t('page_sharing_order_detail_join.Express_information') }}</text>
						</view>
						<view class="pintuan_details_item3_dis" @tap="gojiyunxq" :data-id="xiangqingdetail.line?xiangqingdetail.line.id:0">
							<view class="pintuan_details_item3_dis_l"><image :src="imgUrl + '/dzx_img15.png'"></image></view>
							<view class="pintuan_details_item3_dis_r">
								<view class="pintuan_details_item3_t1">
									<text>{{ xiangqingdetail['line']?xiangqingdetail['line']['name']:"" }}</text>
									<image :src="imgUrl + '/dzx_img42.png'"></image>
								</view>
								<view class="pintuan_details_item3_t2_dis">
									<view class="pintuan_details_item3_t2">
										{{ $t('page_sharing_order_detail_join.shixiao') }}
										<text>{{ xiangqingdetail['line']?xiangqingdetail['line']['limitationofdelivery']:"" }}
										{{ $t('page_sharing_order_detail_join.day') }}</text>
									</view>
									<!-- <view class="pintuan_details_item3_t2" style="margin-left:28rpx;"></view> -->
								</view>
								<view class="pintuan_details_item3_t2">
								{{ $t('page_sharing_order_detail_join.jiesou') }}
								{{ xiangqingdetail['line']?xiangqingdetail['line']['line_special']:"" }}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="pintuan_details_item4">
					<view class="pintuan_details_item2_title">
						<image :src="imgUrl + '/dzx_img30.png'"></image>
						<text>{{ $t('page_sharing_order_detail_join.Group_rule') }}</text>
					</view>
					<view class="pintuan_details_item4_list"><rich-text class="rule" :nodes="article_content"></rich-text></view>
				</view>
			</view>
			<view class="baoguo_btns">
				<view class="baoguo_btns_posi">
					<view class="baoguo_btn" @click="toJoin">{{ $t('page_sharing_order_detail_join.hint1') }}</view>
					<view class="baoguo_btn2" @click="toJoinOrder">{{ $t('page_sharing_order_detail_join.hint2') }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			urlimg: app.globalData.urlimg,
			leader: '',
			xiangqingdetail: '',
			article_content: ''
			//0是待付款，1是待审核，2是待发货，3是已发货，4是已完成
		};
	},
	onPageScroll: function(e) {
		if (e.scrollTop > this.navH + 50) {
			this.banertrue= true
		} else {
			this.banertrue= false
		}
	},
	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad(options) {
		var that = this;
		that.ids= options.order_id
	},
	onShow() {
		var that = this;
		that.xiangqing(); //返回地址id

		let pages = getCurrentPages();
		let currPage = pages[pages.length - 1];

		if (currPage.address_id) {
			this.address_id= currPage.address_id
		}
		if (that.address_id) {
			that.genghuandizhi2();
		}
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		genghuandizhi() {
			//跳转选择地址
			uni.navigateTo({
				url: '/pages/pintuans/dizhi/dizhi?type=xuanze'
			});
		},

		choosecoupon() {
			//跳转选择地址
			uni.navigateTo({
				url: '/pages/mys/my_usercoupon/my_yhq?type=xuanze&free=' + this.free_total
			});
		},
		gojiyunxq(e) {
			uni.navigateTo({
				url:
					'/pages/indexs/jiyunxinxi/jiyunxinxi?id=' + e.currentTarget.dataset.id + '&price=' + e.currentTarget.dataset.price + '&weight=' + e.currentTarget.dataset.weight
			});
		},
		toJoin() {
			uni.navigateTo({
				url: '../indexs/baoguoyg/baoguoyg?from=sharp&share_id=' + this.xiangqingdetail['order_id']
			});
		},
		toJoinOrder() {
			uni.navigateTo({
				url: '/pages/sharing/my_dingdan/my_dingdan?from=sharp&share_id=' + this.xiangqingdetail['order_id']
			});
		},
		viewCopyTextClick: function() {
			var that = this;
			uni.setClipboardData({
				data: that.xiangqingdetail.express_num,
				success: function(res) {
					uni.getClipboardData({
						success: function(res) {
							uni.showToast({
								title: '复制成功'
							});
						}
					});
				}
			});
		},

		qupinjia() {
			uni.navigateTo({
				url: '/pages/indexs/my_dingdan_qpj/my_dingdan_qpj'
			});
		},

		jumpzuo() {
			uni.navigateBack();
		},

		xiangqing() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token'),
				id: that.ids
			};
			request.post(`index.php?s=/api/sharp.order/detail_join&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					var article_content = res.data.data.model.setting;
					article_content = article_content.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block" ');
					that.leader= res.data.data.model.leader
					that.xiangqingdetail= res.data.data.model
					that.article_content= article_content
				}
			});
		},

		genghuandizhi2() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token'),
				address_id: that.address_id,
				id: that.xiangqingdetail.id
			};
			request.post(`index.php?s=/api/package/addressUpdate&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					uni.showToast({
						title: res.data.data
					});
					that.xiangqing();
				} else {
					uni.showToast({
						title: res.data.msg,
						icon: 'none'
					});
				}
			});
		}
	}
};
</script>
<style>
@import './sharing_order_detail_join.css';
</style>
